package vn.wallet.app.managedBean.process;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;

import org.primefaces.extensions.model.layout.LayoutOptions;

@ManagedBean(name = "layoutprocess", eager = true)
@ApplicationScoped
public class LayoutProcess implements Serializable {

	/**
	 * 
	 */
	private static final long	serialVersionUID		= 1L;
	private LayoutOptions		siteLayout;					// site layout
	private LayoutOptions		center_wrapper;				// --center
	private final boolean		ALLOW_LEFT_CHILD_LAYOUT	= true;

	// ------------------------------properties

	@PostConstruct
	public void initLayout() {
		siteLayout = new LayoutOptions();

		// options for all panes
		LayoutOptions panes = new LayoutOptions();
		panes.addOption("slidable", false);
		panes.addOption("spacing", 0);
		panes.addOption("resizeWhileDragging", true);
		siteLayout.setPanesOptions(panes);

		// options for west panel
		LayoutOptions west = new LayoutOptions();
		west.addOption("size", 150);
		west.addOption("closable", false);
		west.addOption("resizable", false);
		siteLayout.setWestOptions(west);

		// options for top panel
		LayoutOptions top = new LayoutOptions();
		top.addOption("size", 75);
		top.addOption("closable", false);
		top.addOption("resizable", false);
		siteLayout.setNorthOptions(top);

		// options for bottom panel
		LayoutOptions bottom = new LayoutOptions();
		bottom.addOption("size", 35);
		bottom.addOption("closable", false);
		bottom.addOption("resizable", false);
		siteLayout.setSouthOptions(bottom);

		// options for center panel
		LayoutOptions center = new LayoutOptions();
		siteLayout.setCenterOptions(center);

		center_wrapper = new LayoutOptions();

		// options for all panes
		LayoutOptions panes_2 = new LayoutOptions();
		panes.addOption("slidable", false);
		panes.addOption("spacing", 0);
		panes.addOption("resizeWhileDragging", true);
		center_wrapper.setPanesOptions(panes_2);

		// options for west panel
		LayoutOptions west_2 = new LayoutOptions();
		west_2.addOption("size", 200);
		west_2.addOption("closable", false);
		west_2.addOption("resizable", false);
		center_wrapper.setWestOptions(west_2);

		// options for center panel
		LayoutOptions center_2 = new LayoutOptions();
		center_wrapper.setCenterOptions(center_2);

		// --level 2
		// //add mainLayout to siteLayout as child panel - index center
		// LayoutOptions site_main_wrapper = new LayoutOptions();
		// center.setChildOptions(site_main_wrapper);
		//
		// LayoutOptions main_wrapper_west = new LayoutOptions();
		// main_wrapper_west.addOption("size", 250);
		// //main_wrapper_west.addOption("maxSize", "50%");
		// site_main_wrapper.setWestOptions(main_wrapper_west);
		//
		// LayoutOptions main_wrapper_center = new LayoutOptions();
		// site_main_wrapper.setCenterOptions(main_wrapper_center);
		//
		// //add mainInfo wrapper
		// LayoutOptions main_info_wrapper = new LayoutOptions();
		// main_wrapper_center.setChildOptions(main_info_wrapper);
		//
		// LayoutOptions main_info_top = new LayoutOptions();
		// main_info_top.addOption("size", 250);
		// //main_info_top.addOption("maxSize", "50%");
		// main_info_wrapper.setNorthOptions(main_info_top);
		//
		// LayoutOptions main_info_center = new LayoutOptions();
		// main_info_wrapper.setCenterOptions(main_info_center);

	}

	public boolean isALLOW_LEFT_CHILD_LAYOUT() {
		return ALLOW_LEFT_CHILD_LAYOUT;

	}

	public LayoutOptions getSiteLayout() {
		return siteLayout;
	}

	public LayoutOptions getCenter_wrapper() {
		return center_wrapper;
	}

}
